import React, { Component } from 'react';
import './List.css'
import Item from './item/item'




export default  class List extends Component {
    deletRow = (row)=>{
        let {onDeletRow} = this.props
        onDeletRow(row)
    }
    render() {
        let {thingsList,onChooseRow} = this.props
        return (
           <>
            <div className='List-box'>
                {
                    thingsList.map((val)=>{
                        return (
                           <div  key={val.id} className='item-box'>
                                <Item {...val} onChooseRow={onChooseRow}/>
                                <button className='del-btn' onClick={()=>this.deletRow(val)}>删除</button>
                           </div>
                        )
                    })
                }
            </div>
           </>
        );
    }
}

